package com.sunrise.generico.entidade;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import lombok.Getter;
import lombok.Setter;

import org.hibernate.validator.constraints.NotEmpty;

import com.sunrise.generico.entidade.iface.EntidadeManter;

@Entity
@Table(name = "recorrencia")
public class Recorrencia implements EntidadeManter {


	/**
	 * 
	 */
	private static final long serialVersionUID = 2724303192308653899L;

	@Id
	@SequenceGenerator(name="pk_sequence",sequenceName="recorrencia_id_seq", allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="pk_sequence")
	@Column
	@Getter @Setter
	private Long id;
	
	@NotEmpty( message="{nomeObrigatorio}")
	@Column(name = "nome", length = 200, nullable = false)
	@Getter @Setter
	private String nome;

	@Getter @Setter
	@Column(name = "valor")
	private BigDecimal valor;
	
	@NotNull
	@Getter @Setter
	@Column(name = "dataLancamento")
	private Date dataLancamento;
	
	@Getter @Setter
	@Column(name = "dataCadastro")
	private Date dataCadastro;
	
	@ManyToOne
	@JoinColumn(name = "receita_id")
	@Getter @Setter
	private Receita receita;
	
	@ManyToOne
	@JoinColumn(name = "despesa_id")
	@Getter @Setter
	private Despesa despesa;
	
}
